<?php

class Empeval_Methods_Request_RemoveBonusGoalsFrom {
	
	/**
	 *
	 * @var App_Methods_Data_App
	 */
	public $app;
	public $bonusGoalsFormId;
	
	public function __construct($params) {
		$this->app = new App_Methods_Data_App($params->app);
		$this->bonusGoalsFormId = $params->bonusGoalsFormId;
	}
	
	public function process() {
		$bonusGoalsForms = EmpevalViewBgfWithSuperiorPositionIdQuery::create()
		->addAccessFilter()
		->filterById($this->bonusGoalsFormId)
		->findOne();
		if (!($bonusGoalsForms instanceof EmpevalViewBgfWithSuperiorPositionId))
			throw new Empeval_Exception_App(Empeval_Exception_Codes::INFO_ACCESS_DENIED);
		EmpevalBonusGoalsFormsQuery::create()
			->filterById($this->bonusGoalsFormId)
			->update(array('DeletedDate' => new DateTime('now')));
		
		return new Empeval_Methods_Response_RemoveBonusGoalsFrom(true);
	}
	
}